package at.sysarch.filter;

import java.io.File;
import java.io.StreamCorruptedException;
import java.util.LinkedList;
import java.util.List;

import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;

import at.pimpmypipe.filter.AbstractSource;
import at.sysarch.domain.TransferImage;

public class Source extends AbstractSource<TransferImage> {
	
	private List<TransferImage> _images;
	
	public Source() {
		
		_images = new LinkedList<TransferImage>();
		
		File file = new File("./Files/loetstellen.jpg");
		
		PlanarImage image = JAI.create("fileload", file.getName());

		TransferImage transfer = new TransferImage();
		
		transfer.setSourceImage(image);
		transfer.setModifiedImage(image);
		
		_images.add(transfer);
	}

	@Override
	public TransferImage read() throws StreamCorruptedException {

		if (_images.size() > 0) {
			
			return _images.remove(0);
		}
		return null;
	}
}